<<<<<<< HEAD
=======
<<<<<<< HEAD
>>>>>>> f60390a2b01ae0ba09cd516dcf60d1ed723adb45
var { fs }=window.myremote;// from '../../browser/remote';
var {remote}=window.myremote.electron;

export function showSaveDialog(filters) {
  return new Promise((resolve, reject) => {
    remote.dialog.showSaveDialog({
      filters,
    }, (fileName) => {
      if (fileName) {
        return resolve(fileName);
      }

      return reject();
    });
  });
}


export function saveFile(fileName, data, encoding = 'utf8') {
  return new Promise((resolve, reject) => {
    fs.writeFile(fileName, data, encoding, err => {
      if (err) { return reject(err); }
      return resolve();
    });
  });
}


export function showOpenDialog(filters, defaultPath) {
  return new Promise((resolve, reject) => {
    remote.dialog.showOpenDialog({
      defaultPath,
      filters,
      properties: ['openFile'],
    }, (fileName) => {
      if (fileName) {
        return resolve(fileName);
      }

      return reject();
    });
  });
}


export function openFile(fileName) {
  return new Promise((resolve, reject) => {
    fs.readFile(fileName, 'utf8', (err, data) => {
      if (err) { return reject(err); }
      return resolve(data);
    });
  });
}
<<<<<<< HEAD
=======
=======
var { fs }=window.myremote;// from '../../browser/remote';
var {remote}=window.myremote.electron;

export function showSaveDialog(filters) {
  return new Promise((resolve, reject) => {
    remote.dialog.showSaveDialog({
      filters,
    }, (fileName) => {
      if (fileName) {
        return resolve(fileName);
      }

      return reject();
    });
  });
}


export function saveFile(fileName, data, encoding = 'utf8') {
  return new Promise((resolve, reject) => {
    fs.writeFile(fileName, data, encoding, err => {
      if (err) { return reject(err); }
      return resolve();
    });
  });
}


export function showOpenDialog(filters, defaultPath) {
  return new Promise((resolve, reject) => {
    remote.dialog.showOpenDialog({
      defaultPath,
      filters,
      properties: ['openFile'],
    }, (fileName) => {
      if (fileName) {
        return resolve(fileName);
      }

      return reject();
    });
  });
}


export function openFile(fileName) {
  return new Promise((resolve, reject) => {
    fs.readFile(fileName, 'utf8', (err, data) => {
      if (err) { return reject(err); }
      return resolve(data);
    });
  });
}
>>>>>>> 1572c5914a1c2861ea611e07c0f1b245e7281167
>>>>>>> f60390a2b01ae0ba09cd516dcf60d1ed723adb45
